﻿using NsbExtensions.Messages.Management.Monitoring;
using NServiceBus;

namespace NsbExtensions.Server.Management.EndpointMonitor.MessageHandlers
{
    public class EndpointStatusMessageHandler : MonitorServiceMessageHandler<EndpointStatusUpdateNotification>,
                                                IMessageHandler<EndpointOnlineNotification>,
                                                IMessageHandler<EndpointOfflineNotification>
    {
        #region IMessageHandler<EndpointOfflineNotification> Members

        public void Handle(EndpointOfflineNotification message)
        {
            MonitorService.UpdateEndpointStatus(message);
        }

        #endregion

        #region IMessageHandler<EndpointOnlineNotification> Members

        public void Handle(EndpointOnlineNotification message)
        {
            MonitorService.UpdateEndpointStatus(message);
        }

        #endregion

        public override void Handle(EndpointStatusUpdateNotification message)
        {
            MonitorService.UpdateEndpointStatus(message);
        }
    }
}